<template>
  <div>

    <el-container style="height: 600px; border: 1px solid #eee">
      <!-- 侧边栏 -->
      <el-aside :width="asideWidth" style="background-color: #001529;height:600px;">

        <div style="height:60px; color: white; display: flex; align-items: center; justify-content: center" >
          <img src="@/assets/logo.png" style="width: 40px; height: 40px;">
          <span style="margin-left: 5px;font-size: 20px"v-show="!this.isCollapsed">智慧校园</span><!-- v-show="!this.isCollapsed"侧边栏收回的时候隐藏文字 -->
        </div>

        <el-menu :collapse="isCollapsed" :collapse-transition="false" :default-openeds="['']" background-color="#001529" text-color="#ffff" active-text-color="#fff">
          <el-submenu index="0">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 首页</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-0">
                <router-link to="/yemian/apache" class="link1">首页</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 学生管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/student" class="link1">学生管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 教室管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/classroom" class="link1">教室管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 员工管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/yuangong" class="link1">员工管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 班级管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/class" class="link1">班级管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="5">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 宿舍管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/dormitory" class="link1">宿舍管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="6">
            <template slot="title"><i class="el-icon-setting"></i><span v-show="!this.isCollapsed"> 考试管理</span></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/yemian/examPlace" class="link1">考试管理</router-link>
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link to="/yemian/examPlan" class="link1">计划管理</router-link>
              </el-menu-item>
              <el-menu-item index="1-3">
                <router-link to="/yemian/examSubject" class="link1">科目管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>

      <el-container>
        <!-- 头部 -->
        <el-header style="background-color: #ffffff;box-shadow:2px 0 6px rgba(0,21,41,.35); display: flex; align-items: center;">
          <i class="el-icon-s-fold" style="width: 60px; height: 40px; margin-top: 20px" @click="handleCollapes"></i>
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/yemian/user' }">用户管理</el-breadcrumb-item>
          </el-breadcrumb>

          <el-input v-model="input" placeholder="请输入" style="width: 400px; height: 60px;padding-left: 100px"></el-input>

          <div style="flex: 1; width: 0; display: flex; align-items: center; justify-content: flex-end;" >
            <el-dropdown placement="bottom">
              <div style="display: flex; align-items: center; ">
                <img src="@/assets/logo.png" alt="" style="width: 40px; height: 40px; border-radius: 30px; margin: 0 10px">
                <span>管理员</span>
              </div>

              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>个人信息</el-dropdown-item>
                <el-dropdown-item>修改密码</el-dropdown-item>
                <el-dropdown-item @click.native="goToPage1">退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-header>
        <!-- 子路由(身体) -->
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    //下拉框选择器
    return {
      input : "",

      options: [
        {
          value: "选项1",
          value1: "选项1",
          label: "男",
        },
        {
          value: "选项2",
          value1: "选项2",
          label: "女",
        },
      ],
      value: "",
      isCollapsed : false,//不收缩或不收缩
      asideWidth : '200px'//侧边栏的长度
    };
  },
  methods: {
    handleCollapes(){
      this.isCollapsed = !this.isCollapsed
      this.asideWidth = this.isCollapsed ? '64px': '200px'
    },
    goToPage1() {
      this.$router.push('/login'); // 跳转到页面1，例如 /page1
    },
  }
};
</script>
<!-- 大页面 -->
<style>

.el-aside {/*侧边栏*/
  color: #333;
  box-shadow:2px 0 6px rgba(0,21,41,.35);/* 侧边栏阴影 */
  transition: width .3s;
}
.el-menu--inline .el-menu-item {  /*子菜单*/
  background-color: #000c17 !important; ;
  color: #ffffff;
}

.el-menu-item :hover{/* 鼠标移入 */
  color: #fff !important;
}

.link1{/*  子菜单 */
  text-decoration: none;
  color: rgba(255,255,255,0.65);
}

</style>
